package com.example.activity_service.controller;

import com.example.activity_service.service.PrizesService;
import com.example.activity_service.vo.Draw;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class PrizesController {
    @Autowired
    PrizesService prizesService;

    @RequestMapping("/prizeUser")
    public List<Draw> select(){
        List<Draw> list=prizesService.draws ();
        return list;
    }
    @RequestMapping("/recharge")
    private int recharge(@RequestParam("users") int users,
                            @RequestParam("redenvelopes") String redenvelopes,
                            @RequestParam("parvalue")Double parvalue){
        System.out.println (users);System.out.println (redenvelopes);
        System.out.println (parvalue);
        int n = prizesService.recharge (users,redenvelopes,parvalue);
        return n;
//        if (!n.equals ("谢谢惠顾")){
//            return "恭喜抽中"+redenvelopes;
//        }else {
//            return "谢谢惠顾";
//        }
    }

}

